import {Routes} from '@angular/router';
import {LoginComponent} from "./login/login.component";
import {HomeComponent} from "./home/home.component";
import {UserComponent} from "./user/user.component";
import {RouteGuard} from "./route.guard";
import {NotFoundComponent} from "./404/404.component";
import {UserInfoComponent} from "./user-info/user-info.component";

export const routes: Routes = [
  {path: '', redirectTo: 'home', pathMatch: 'full'},
  {path: '404', component: NotFoundComponent},
  {
    path: 'home', component: HomeComponent,
    canActivate: [RouteGuard],
    children: [
      {
        outlet: 'primary', path: 'user', component: UserComponent,
        canActivate: [RouteGuard],
      }
    ]
  },
  {
    path: 'userInfo/:userId', component: UserInfoComponent,
    canActivate: [RouteGuard],
  },
  {path: 'login', component: LoginComponent},
];
